package com.oocl.euc.common.constant;

import java.util.HashMap;
import java.util.Map;

public class ApplicationConstant {
    private ApplicationConstant(){}
    public static final String YES = "Yes";
    public static final String NO = "No";
    public static final String REPAIR = "0";
    public static final String SYSTEM = "system";
    public static final String PCRS = "PCRS";
    public static final String PCRS_TT_MSG_TYPE = "98";
    public static final String PCRS_PREFIX = "pcrs-";

    // JWT SSO related constant
    public static final String OPENTOKEN_COOKIE = "SSO_PCRS_OPENTOKEN_COOKIE";
    public static final String JWT_ACCESS_TOKEN = "PCRS_JWT_ACCESS_TOKEN";
    public static final String USERID_COOKIE = "SSO_PCRS_USERID_COOKIE";
    public static final String JWT_TOKEN_PREFIX = "Bearer ";
    public static final String JWT_TOKEN_HEADER = "authentication";
    public static final String PCRS_SERVICE_ACCOUNT = "pcrsServiceAccount";

    public static final String USER_CONTEXT = "userContext";

    private static final String CONVERSATION_EMAIL_ROLE_ENDORSER_LIST = "${ENDORSER_LIST};";

    private static final String CONVERSATION_EMAIL_ROLE_ENDORSER = "${ENDORSER};";

    public static final String CONVERSATION_EMAIL_ROLE_ALL = "ALL";

    public static Map<String, String> getSendConversationEmailToAndBCCRelatedMap(String requestStatus) {
        if (RequestFormStatus.PENDING.equals(requestStatus) || RequestFormStatus.NEW.equals(requestStatus)) {
            sendConversationEmailToAndBCCRelateMap.put("ENDORSER", CONVERSATION_EMAIL_ROLE_ENDORSER_LIST);
            sendConversationEmailToAndBCCRelateMap.put("ALL", sendConversationEmailToAndBCCRelateMap.get("ALL") + CONVERSATION_EMAIL_ROLE_ENDORSER_LIST);
        } else {
            sendConversationEmailToAndBCCRelateMap.put("ENDORSER", CONVERSATION_EMAIL_ROLE_ENDORSER);
            sendConversationEmailToAndBCCRelateMap.put("ALL", sendConversationEmailToAndBCCRelateMap.get("ALL") + CONVERSATION_EMAIL_ROLE_ENDORSER);
        }
        return sendConversationEmailToAndBCCRelateMap;
    }


    private static final Map<String, String> sendConversationEmailToAndBCCRelateMap = new HashMap<>();

    static {
        sendConversationEmailToAndBCCRelateMap.put("HKCTR", "HKCTR;");
        sendConversationEmailToAndBCCRelateMap.put("CHGCNTL", "CHGCNTL;");
        sendConversationEmailToAndBCCRelateMap.put("ALL", "HKCTR;CHGCNTL;${REQUESTER};${CHANGE_EXECUTOR};${NOTIFYPERSONS};${CHANGE_RECOVERY_HANDLER};${SECOND_VERIFIER};${CHANGE_VERIFIER};");
        sendConversationEmailToAndBCCRelateMap.put("REQUESTER", "${REQUESTER};");
        sendConversationEmailToAndBCCRelateMap.put("EXECUTOR", "${CHANGE_EXECUTOR};");
        sendConversationEmailToAndBCCRelateMap.put("NOTIFYPERSONS", "${NOTIFYPERSONS};");
        sendConversationEmailToAndBCCRelateMap.put("FALLBACK HANDLER", "${CHANGE_RECOVERY_HANDLER};");
        sendConversationEmailToAndBCCRelateMap.put("FIRST VERIFIER", "${CHANGE_VERIFIER};");
        sendConversationEmailToAndBCCRelateMap.put("SECOND VERIFIER", "${SECOND_VERIFIER};");
    }


}
